home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / rsctoc2.arc / MAIN.C next >
Encoding:
C/C++ Source or Header  |  1988-06-26  |  16.5 KB  |  680 lines

  1. /***************************************************/
  2. /*                             */
  3. /*               RSCTOC  V1.0           */
  4. /*                             */
  5. /*  Copyright (c) 1988, by Robert Joseph Silliker  */
  6. /*            All Rights Reserved          */
  7. /*      Permission is granted for unrestricted     */
  8. /*           non-commercial use           */
  9. /*                             */
  10. /***************************************************/
  11.  
  12. #include <stdio.h>
  13. #include <fcntl.h>
  14. #include <osbind.h>
  15. #include <gemdefs.h>
  16. #include <obdefs.h>
  17.  
  18. static char *copyright[] = "RSCTOC V1.0\nCopyright (c) 1988, by\
  19.  Robert Joseph Silliker\nAll Rights Reserved\n\
  20.  Permission is granted for unrestricted non-commercial use\n";
  21.  
  22. long _stksize = 16000;
  23.  
  24. RSHDR *rschead;            /* Pointer to the resource file header. */
  25. char *out_path = NULL;        /* Path to output file. */
  26. char *rsc_path = NULL;        /* Path to input file.  */
  27. FILE *fp = stdout;        /* Default output file. */
  28. char *prefix= "";        /* Prefix to the names of arrays. */
  29.  
  30. #define MAXTREES 512        /* Maximum number of object trees per file. */
  31.  
  32. OBJECT *objects;        /* Pointer to the base of the objects. */
  33. OBJECT *trindex[MAXTREES];    /* One pointer per object tree. */
  34.  
  35. char *progname = "rsctoc.ttp";    /* Program name (no argv[0]) */
  36.  
  37.  
  38. main(argc, argv)
  39. int argc;
  40. char *argv[];
  41. {
  42.   int i;
  43.   extern char *rsc_path, *out_path, *prefix;
  44.   extern FILE *fp;
  45.   
  46.   if((argc != 2) && (argc != 4) && (argc != 6))
  47.     usage("Incorrect number of arguments.");
  48.  
  49.   rsc_path = argv[1];
  50.  
  51.   for(i=2; i<argc; i+=2) {        /* This lets option arguments like */
  52.     if(!strcmp(argv[i], "-p"))        /* rsctoc.ttp rsc_file -f file1 -f file2 */
  53.       prefix = argv[i+1];        /* rsctoc.ttp rsc_file -p XXXX -p YYYY */
  54.     else if(!strcmp(argv[i], "-o")) /* without a usage error. */
  55.       out_path = argv[i+1];
  56.     else
  57.       usage("Illegal option.");
  58.   }
  59.  
  60.   if(!init_prog()) {
  61.     put_header();
  62.     make_tedinfo();
  63.     make_icon();
  64.     make_bitblk();
  65.     make_object();
  66.     make_index();
  67.     make_fix();
  68.   }
  69.  
  70.   clean_up();
  71. }
  72.  
  73.  
  74. /*----------------------------------------*/
  75. /* Output the usage message and terminate */
  76. /* the program.                           */
  77. /*----------------------------------------*/
  78.  
  79. usage(s)
  80. char *s;
  81. {
  82.   extern char *progname;
  83.  
  84.   if(s)
  85.     fprintf(stderr, "%s: %s\n", progname, s);
  86.  
  87.   fprintf(stderr, "Usage: %s rsc_file [-p prefix] [-o outfile]\n", progname);
  88.  
  89.   exit(2);
  90. }
  91.  
  92.  
  93. /*-------------------------------------------*/
  94. /* Output an error message and terminate the */
  95. /* program gracefully if the caller sets the */
  96. /* terminate flag.  The value of the flag    */
  97. /* used to terminate is returned by the      */
  98. /* program.                                  */
  99. /*-------------------------------------------*/
  100.  
  101. mperror(terminate, s)
  102. int terminate;
  103. char *s;
  104. {
  105.   extern char *progname;
  106.  
  107.   fprintf(stderr, "%s: %s\n", progname, s);
  108.  
  109.   if(terminate) {
  110.     clean_up();
  111.     exit(terminate);
  112.   }
  113. }
  114.  
  115.  
  116. /*-------------------------*/
  117. /* Initialize the program. */
  118. /*-------------------------*/
  119.  
  120. int init_prog()
  121. {
  122.   int i;
  123.   extern char *rsc_path, *out_path;
  124.   extern FILE *fp;
  125.   extern RSHDR *rschead;
  126.  
  127.   if(!myrsrc_load(rsc_path))
  128.     mperror(1, "Error getting resource file.");
  129.  
  130.   if(out_path != NULL) {
  131.     if((fp = fopen(out_path, "w")) == NULL)
  132.       mperror(1, "Can't open output file.");
  133.   }
  134.  
  135.   if(rschead->rsh_nobs <= 0)
  136.     mperror(1, "No object trees to dump.");
  137.  
  138.   return(0);
  139. }
  140.  
  141.  
  142. /*--------------------------------------------*/
  143. /* Clean up open files, close the workstation */
  144. /* and close the aes application.             */
  145. /*--------------------------------------------*/
  146.  
  147. clean_up()
  148. {
  149.   extern FILE *fp;
  150.  
  151.   if((fp != stdout) && (fp != NULL))
  152.     fclose(fp);
  153. }
  154.  
  155.  
  156. /*------------------------------*/
  157. /* Extract tedinfo information. */
  158. /*------------------------------*/
  159.  
  160. make_tedinfo()
  161. {
  162.   int i, first_one;
  163.   register OBJECT *g;
  164.   TEDINFO *t;
  165.   extern char *prefix;
  166.   extern FILE *fp;
  167.   extern OBJECT *objects;
  168.   extern RSHDR *rschead;
  169.  
  170.   fprintf(fp, "TEDINFO %srs_tedinfo[] = {\n", prefix);
  171.  
  172.   for(i=0, first_one=1, g=objects; i < rschead->rsh_nobs; i++, g++) {
  173.     if(g->ob_type == G_FTEXT || g->ob_type == G_FBOXTEXT ||
  174.        g->ob_type == G_TEXT  || g->ob_type == G_BOXTEXT) {
  175.  
  176.       if(first_one) {
  177.       first_one = 0;
  178.       }
  179.       else
  180.         fprintf(fp, ",\n");
  181.  
  182.       t = (TEDINFO *)(g->ob_spec);
  183.  
  184.       if(strlen(t->te_ptext))
  185.         fprintf(fp, "  {\"%s\", ", t->te_ptext);
  186.       else
  187.         fprintf(fp, "  {%sp_to_nul, ", prefix);
  188.  
  189.       if(strlen(t->te_ptmplt))
  190.         fprintf(fp, "\"%s\", ", t->te_ptmplt);
  191.       else
  192.         fprintf(fp, "%sp_to_nul, ", prefix);
  193.  
  194.       if(strlen(t->te_pvalid))
  195.         fprintf(fp, "\"%s\",\n  ", t->te_pvalid);
  196.       else
  197.         fprintf(fp, "%sp_to_nul,\n   ", prefix);
  198.  
  199.       fprintf(fp, "%3d, ", t->te_font);
  200.       fprintf(fp, "%3d, ", t->te_junk1);
  201.       fprintf(fp, "%3d, ", t->te_just);
  202.       fprintf(fp, "%3d, ", t->te_color);
  203.       fprintf(fp, "%3d, ", t->te_junk2);
  204.       fprintf(fp, "%3d, ", t->te_thickness);
  205.       fprintf(fp, "%3d, ", t->te_txtlen);
  206.       fprintf(fp, "%3d}", t->te_tmplen);
  207.     }
  208.   }
  209.  
  210.   if(!first_one)
  211.     fprintf(fp, "\n};\n\n");
  212.   else
  213.     fprintf(fp, "  0L\n};\n\n");
  214. }
  215.  
  216.  
  217. /*---------------------------*/
  218. /* Extract icon information. */
  219. /*---------------------------*/
  220.  
  221. make_icon()
  222. {
  223.   int i, j, k, numb;
  224.   int first_one, *p;
  225.   register OBJECT *g;
  226.   extern char *prefix;
  227.   ICONBLK *icon;
  228.   extern FILE *fp;
  229.   extern OBJECT *objects;
  230.   extern RSHDR *rschead;
  231.  
  232.   for(i=0, numb=0, g=objects; i < rschead->rsh_nobs; i++, g++) {
  233.     /*----------------------*/
  234.     /* First do the images. */
  235.     /*----------------------*/
  236.  
  237.     if(g->ob_type == G_ICON) {
  238.       icon = (ICONBLK *)(g->ob_spec);
  239.  
  240.       fprintf(fp, "int %simask%03d[] = {", prefix, numb);
  241.       k = icon->ib_hicon * (icon->ib_wicon/16);
  242.  
  243.       for(j=0, p=icon->ib_pmask; k > 0; j++, p++, k--) {
  244.         if(!(j % 8))
  245.           fprintf(fp, "\n  ");
  246.         fprintf(fp, "0x%04x", *p);
  247.  
  248.     if(k != 1)
  249.           fprintf(fp, ",");
  250.       }
  251.       fprintf(fp, "\n};\n\n");
  252.  
  253.       fprintf(fp, "int %sidata%03d[] = {", prefix, numb);
  254.       k = icon->ib_hicon * (icon->ib_wicon/16);
  255.  
  256.       for(j=0, p=icon->ib_pdata; k > 0; j++, p++, k--) {
  257.         if(!(j % 8))
  258.       fprintf(fp, "\n   ");
  259.         fprintf(fp, "0x%04x", *p);
  260.  
  261.         if(k != 1)
  262.       fprintf(fp, ",");
  263.       }
  264.  
  265.       fprintf(fp, "\n};\n\n");
  266.       numb++;
  267.     }
  268.   }
  269.  
  270.   fprintf(fp, "ICONBLK %srs_iconblk[] = {\n", prefix);
  271.  
  272.   for(i=0, numb=0, g=objects, first_one=1; i < rschead->rsh_nobs; i++, g++) {
  273.     /*-----------------------------*/
  274.     /* Now do the icon structures. */
  275.     /*-----------------------------*/
  276.  
  277.     if(g->ob_type == G_ICON) {
  278.  
  279.       if(first_one)
  280.         first_one = 0;
  281.       else
  282.         fprintf(fp, ",\n");
  283.  
  284.       icon = (ICONBLK *)(g->ob_spec);
  285.  
  286.       fprintf(fp, "  {%simask%03d, %sidata%03d, ", prefix, numb, prefix, numb);
  287.  
  288.       if(strlen(icon->ib_ptext))
  289.         fprintf(fp, "\"%s\",\n", icon->ib_ptext);
  290.       else
  291.         fprintf(fp, "%sp_to_nul, \n", prefix);
  292.  
  293.       fprintf(fp, "   0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x,\n",
  294.               icon->ib_char, icon->ib_xchar, icon->ib_ychar,
  295.                   icon->ib_xicon, icon->ib_yicon, icon->ib_wicon);
  296.  
  297.       fprintf(fp, "   0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x}",
  298.           icon->ib_hicon, icon->ib_xtext, icon->ib_ytext,
  299.           icon->ib_wtext, icon->ib_htext);
  300.       numb++;
  301.     }
  302.   }
  303.  
  304.   if(!first_one)
  305.     fprintf(fp, "\n};\n\n");
  306.   else
  307.     fprintf(fp, "  0L\n};\n\n");
  308. }
  309.  
  310.  
  311.  
  312. /*-----------------------------*/
  313. /* Extract bitblk information. */
  314. /*-----------------------------*/
  315.  
  316. make_bitblk()
  317. {
  318.   int i, j, k, numb;
  319.   int first_one, *p;
  320.   register OBJECT *g;
  321.   BITBLK *bitblk;
  322.   extern char *prefix;
  323.   extern FILE *fp;
  324.   extern OBJECT *objects;
  325.   extern RSHDR *rschead;
  326.  
  327.   for(i=0, numb=0, g=objects; i < rschead->rsh_nobs; i++, g++) {
  328.     /*----------------------*/
  329.     /* First do the images. */
  330.     /*----------------------*/
  331.  
  332.     if(g->ob_type == G_IMAGE) {
  333.       bitblk = (BITBLK *)(g->ob_spec);
  334.  
  335.       fprintf(fp, "int %sbblock%03d[] = {", prefix, numb);
  336.       k = bitblk->bi_hl * (bitblk->bi_wb/2);
  337.  
  338.       for(j=0, p=bitblk->bi_pdata; k > 0; j++, p++, k--) {
  339.         if(!(j % 8))
  340.           fprintf(fp, "\n  ");
  341.         fprintf(fp, "0x%04x", *p);
  342.  
  343.     if(k != 1)
  344.           fprintf(fp, ",");
  345.       }
  346.       fprintf(fp, "\n};\n\n");
  347.  
  348.       numb++;
  349.     }
  350.   }
  351.  
  352.   fprintf(fp, "BITBLK %srs_bitblk[] = {\n", prefix);
  353.  
  354.   for(i=0, numb=0, g=objects, first_one=1; i < rschead->rsh_nobs; i++, g++) {
  355.     /*-------------------------------*/
  356.     /* Now do the bitblk structures. */
  357.     /*-------------------------------*/
  358.  
  359.     if(g->ob_type == G_IMAGE) {
  360.  
  361.       if(first_one)
  362.         first_one = 0;
  363.       else
  364.         fprintf(fp, ",\n");
  365.  
  366.       bitblk = (BITBLK *)(g->ob_spec);
  367.  
  368.       fprintf(fp, "  {%sbblock%03d, ", prefix, numb);
  369.  
  370.       fprintf(fp, " 0x%04x, 0x%04x, 0x%04x, 0x%04x, 0x%04x}",
  371.                         bitblk->bi_wb, bitblk->bi_hl, bitblk->bi_x,
  372.                             bitblk->bi_y, bitblk->bi_color);
  373.  
  374.       numb++;
  375.     }
  376.   }
  377.  
  378.   if(!first_one)
  379.     fprintf(fp, "\n};\n\n");
  380.   else
  381.     fprintf(fp, "  0L\n};\n\n");
  382. }
  383.  
  384.  
  385. /*-----------------------------------------------*/
  386. /* Extract object information and change into C. */
  387. /*-----------------------------------------------*/
  388.  
  389. make_object()
  390. {
  391.   int i, ic, bb, ted;
  392.   int first_one;
  393.   register OBJECT *g;
  394.   extern char *prefix;
  395.   extern FILE *fp;
  396.   extern OBJECT *objects;
  397.   extern RSHDR *rschead;
  398.  
  399.   for(i=0,ic=0,bb=0,ted=0,g=objects,first_one=1; i<rschead->rsh_nobs;i++,g++) {
  400.     if(first_one) {
  401.       fprintf(fp, "OBJECT %srs_object[] = {\n", prefix);
  402.       first_one = 0;
  403.     }
  404.     else
  405.       fprintf(fp, ",\n");
  406.  
  407.     print_index_comment(g);
  408.  
  409.     fprintf(fp, "  {%4d,%4d,%4d,0x%04x,0x%04x,0x%04x, ",
  410.                                 g->ob_next, g->ob_head, g->ob_tail,
  411.                                 g->ob_type, g->ob_flags, g->ob_state);
  412.  
  413.     if(g->ob_type == G_STRING || g->ob_type == G_TITLE
  414.                               || g->ob_type == G_BUTTON) {
  415.  
  416.       if(strlen(g->ob_spec))
  417.         fprintf(fp, "\"%s\",", g->ob_spec);
  418.       else
  419.         fprintf(fp, "%sp_to_nul,", prefix);
  420.     }
  421.     else if(g->ob_type == G_FTEXT || g->ob_type == G_FBOXTEXT
  422.                                   || g->ob_type == G_TEXT
  423.                                   || g->ob_type == G_BOXTEXT) {
  424.       fprintf(fp, "\&%srs_tedinfo[%d],", prefix, ted);
  425.       ted++;
  426.     }
  427.     else if(g->ob_type == G_ICON) {
  428.       fprintf(fp, "\&%srs_iconblk[%d],", prefix, ic);
  429.       ic++;
  430.     }
  431.     else if(g->ob_type == G_IMAGE) {
  432.       fprintf(fp, "\&%srs_bitblk[%d],", prefix, bb);
  433.       bb++;
  434.     }
  435.     else
  436.       fprintf(fp, "0x%08lxL,", g->ob_spec);
  437.  
  438.     fprintf(fp, "%4d,%4d,%4d,%4d}",
  439.         g->ob_x, g->ob_y, g->ob_width, g->ob_height);
  440.   }
  441.  
  442.   if(!first_one)
  443.     fprintf(fp, "\n};\n\n");
  444. }
  445.  
  446.  
  447. /*-----------------------------------------------*/
  448. /* Build the array of tree pointers and generate */
  449. /* the structure size macros.                    */
  450. /*-----------------------------------------------*/
  451.  
  452. make_index()
  453. {
  454.   int i, index, first_one;
  455.   extern char *prefix;
  456.   extern FILE *fp;
  457.   extern OBJECT *objects, *trindex[];
  458.   extern RSHDR *rschead;
  459.  
  460.   for(i=0, first_one=1; i < rschead->rsh_ntree; i++) {
  461.     if(first_one) {
  462.       fprintf(fp, "OBJECT *%srs_trindex[] = {\n", prefix);
  463.       first_one = 0;
  464.     }
  465.     else
  466.       fprintf(fp, ",\n");
  467.  
  468.     index = (trindex[i] - objects);
  469.  
  470.     fprintf(fp, "  &%srs_object[%d]", prefix, index);
  471.   }
  472.   if(!first_one)
  473.     fprintf(fp, "\n};\n\n");
  474.  
  475.   fprintf(fp, "#define %sNUM_TI %d\n", prefix, rschead->rsh_nted);
  476.   fprintf(fp, "#define %sNUM_IB %d\n", prefix, rschead->rsh_nib);
  477.   fprintf(fp, "#define %sNUM_BB %d\n", prefix, rschead->rsh_nbb);
  478.   fprintf(fp, "#define %sNUM_OBS %d\n", prefix, rschead->rsh_nobs);
  479.   fprintf(fp, "#define %sNUM_TREE %d\n\n\n", prefix, rschead->rsh_ntree);
  480. }
  481.  
  482.  
  483. /*------------------------------------------------------*/
  484. /* Output the include #ifdef for the object definition  */
  485. /* header file.  Output a single NUL character pointer  */
  486. /* into the C source.  This will be used as the pointer */
  487. /* to an empty character string wherever strings have   */
  488. /* zero length.                                         */
  489. /*------------------------------------------------------*/
  490.  
  491. put_header()
  492. {
  493.   extern FILE *fp;
  494.  
  495.   fprintf(fp, "#ifndef OBJECT\n");
  496.   fprintf(fp, "#include <obdefs.h>\n");
  497.   fprintf(fp, "#endif\n\n");
  498.   fprintf(fp, "static char %sp_to_nul[1] = \"\";\n\n", prefix);
  499. }
  500.  
  501.  
  502. /*-------------------------------------------*/
  503. /* Output code that will fix up the objects. */
  504. /*-------------------------------------------*/
  505.  
  506. make_fix()
  507. {
  508.   extern char *prefix;
  509.   extern FILE *fp;
  510.  
  511.   fprintf(fp, "%sfix_objects()\n{\n", prefix);
  512.   fprintf(fp, "  register int i;\n\n");
  513.   fprintf(fp, "  for(i=0; i<%sNUM_OBS; i++)\n", prefix);
  514.   fprintf(fp, "    rsrc_obfix(%srs_object, i);\n", prefix);
  515.   fprintf(fp, "}\n\n");
  516. }
  517.  
  518.  
  519. /*--------------------------------*/
  520. /* Open and read in the rsc file. */
  521. /* Then call the routine to fix   */
  522. /* the object pointers.           */
  523. /*--------------------------------*/
  524.  
  525. char *pbase;            /* Pointer to base of file in memory */
  526. #define BLKSIZE 8192        /* Number of bytes per read call */
  527.                 /* Don't make this larger than 32767 */
  528.  
  529. myrsrc_load(path)
  530. char *path;
  531. {
  532.   long fsize, lseek();
  533.   int rsc, size;
  534.   char *p;
  535.   extern char *pbase;
  536.  
  537.   if((rsc = open(path, O_RDONLY | O_BINARY)) < 0) {
  538.     fprintf(stderr, "%s: Can't open '%s'.\n", progname, path);
  539.     return(0);
  540.   }
  541.  
  542.   if((fsize = lseek(rsc, 0L, 2)) < 0)
  543.     return(0);
  544.  
  545.   lseek(rsc, 0L, 0);
  546.  
  547.   if(fsize < sizeof(RSHDR)) {
  548.     fprintf(stderr, "%s: Resource file is too small.\n", progname);
  549.     close(rsc);
  550.     return(0);
  551.   }
  552.  
  553.   p = pbase = (char *)(Malloc(fsize));
  554.   if(pbase == NULL) {
  555.     fprintf(stderr, "%s: Not enough memory.\n", progname);
  556.     close(rsc);
  557.     return(0);
  558.   }
  559.  
  560.   do {
  561.     size = (fsize >= BLKSIZE) ? BLKSIZE : (int)(fsize);
  562.     if(read(rsc, p, size) != size) {
  563.       fprintf(stderr, "%s: Read error on '$s'.\n", progname, path);
  564.       Mfree(pbase);
  565.       close(rsc);
  566.       return(0);
  567.     }
  568.     p += size;
  569.     fsize -= (long)(size);
  570.   } while(fsize > 0L);
  571.  
  572.   close(rsc);
  573.  
  574.   fix_pointers();
  575.  
  576.   return(1);
  577. }
  578.  
  579.  
  580. /*------------------------------------------*/
  581. /* Routine to fix up the resource pointers. */
  582. /*------------------------------------------*/
  583.  
  584. fix_pointers()
  585. {
  586.   int i;
  587.   long *t;
  588.   extern char *pbase;
  589.   extern OBJECT *objects, *trindex[];
  590.   extern RSHDR *rschead;
  591.  
  592.   /*----------------------------------------------------*/
  593.   /* Initialize the pointer to the resource file header */
  594.   /* and a pointer to the base of the object array.     */
  595.   /*----------------------------------------------------*/
  596.  
  597.   rschead = (RSHDR *)(pbase);
  598.   objects = (OBJECT *)(pbase + rschead->rsh_object);
  599.  
  600.   t = (long *)(pbase + rschead->rsh_trindex);    /* Get pointer to trindex */
  601.  
  602.   for(i=0; i<rschead->rsh_ntree; i++)
  603.     trindex[i] = (OBJECT *)(pbase + *(t+i));    /* Build tree pointer */
  604.  
  605.   /*---------------------------------------------------*/
  606.   /* Fix all the objects.  No need to go into the maze */
  607.   /* of head, tail, next because all objects are in a  */
  608.   /* nice array of size 'rsh_nobs'.                    */
  609.   /*---------------------------------------------------*/
  610.  
  611.   for(i=0; i<rschead->rsh_nobs; i++)
  612.     fix_one_object(objects + i);
  613. }
  614.  
  615.  
  616. /*-------------------------------------*/
  617. /* Fix up the pointers for one object. */
  618. /*-------------------------------------*/
  619.  
  620. fix_one_object(g)
  621. register OBJECT *g;
  622. {
  623.   TEDINFO *t;
  624.   ICONBLK *icon;
  625.   BITBLK *bitblk;
  626.   extern char *pbase;
  627.  
  628.   switch(g->ob_type) {
  629.     case(G_STRING):
  630.     case(G_TITLE):
  631.     case(G_BUTTON):
  632.       g->ob_spec = (char *)(pbase + (long)(g->ob_spec));
  633.       break;
  634.     case(G_FTEXT):
  635.     case(G_FBOXTEXT):
  636.     case(G_TEXT):
  637.     case(G_BOXTEXT):
  638.       t = (TEDINFO *)(pbase + (long)(g->ob_spec));
  639.       g->ob_spec = (char *)(t);
  640.       t->te_ptext = (char *)(pbase + (long)(t->te_ptext));
  641.       t->te_ptmplt = (char *)(pbase + (long)(t->te_ptmplt));
  642.       t->te_pvalid = (char *)(pbase + (long)(t->te_pvalid));
  643.       break;
  644.     case(G_ICON):
  645.       icon = (ICONBLK *)(pbase + (long)(g->ob_spec));
  646.       g->ob_spec = (char *)(icon);
  647.       icon->ib_pmask = (int *)(pbase + (long)(icon->ib_pmask));
  648.       icon->ib_pdata = (int *)(pbase + (long)(icon->ib_pdata));
  649.       icon->ib_ptext = (char *)(pbase + (long)(icon->ib_ptext));
  650.       break;
  651.     case(G_IMAGE):
  652.       bitblk = (BITBLK *)(pbase + (long)(g->ob_spec));
  653.       g->ob_spec = (char *)(bitblk);
  654.       bitblk->bi_pdata = (int *)(pbase + (long)(bitblk->bi_pdata));
  655.       break;
  656.   }
  657. }
  658.  
  659.  
  660. /*---------------------------------*/
  661. /* Print the rs_trindex[] comment. */
  662. /*---------------------------------*/
  663.  
  664. print_index_comment(g)
  665. OBJECT *g;
  666. {
  667.   register int i;
  668.   extern OBJECT *trindex[];
  669.   extern FILE *fp;
  670.   extern RSHDR *rschead;
  671.  
  672.   for(i=0; i<rschead->rsh_ntree; i++) {
  673.     if(trindex[i] == g)
  674.       fprintf(fp, "  /* Tree #%d*/\n", i);
  675.   }
  676. }
  677.  
  678. /* END OF FILE */
  679.  
  680.